# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Aleksandar Trifunović <akstrfn@gmail.com>
# Contributor: Iván Ruvalcaba <mario.i.ruvalcaba@gmail.com>
# Contributor: Ian Ker-Seymer <i.kerseymer@gmail.com>

pkgname=neovim-qt
pkgver=0.2.18
pkgrel=1
pkgdesc='GUI for Neovim'
arch=(loong64 x86_64)
url='https://github.com/equalsraf/neovim-qt'
license=(ISC)
depends=(neovim qt5-svg hicolor-icon-theme)
makedepends=(cmake git)
checkdepends=(ttf-dejavu xorg-server-xvfb)
source=("git+$url#commit=1854bdc2b481a90a7845c2f17e5da0519bf16f48") # tag: v0.2.18
b2sums=('SKIP')

build() {
  cmake \
    -B build \
    -D CMAKE_BUILD_TYPE=Release \
    -D CMAKE_C_FLAGS="$CFLAGS" \
    -D CMAKE_CXX_FLAGS="$CXXFLAGS" \
    -D CMAKE_EXE_LINKER_FLAGS="$LDFLAGS" \
    -D CMAKE_INSTALL_LIBDIR=lib \
    -D CMAKE_INSTALL_PREFIX=/usr \
    -D USE_SYSTEM_MSGPACK=on \
    -S $pkgname
  make -C build
}

check() {
  xvfb-run make -v -C build test
}

package() {
  DESTDIR="$pkgdir" make -C build install
  install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" "$pkgname/LICENSE"
}
